1 <?php
2     include(
"../includes/config.php");
3     session_start();
4     
if(isset($_SESSION['admin_login'])) {
5         
if($_SESSION['admin_login'] == true) {
6             $query_selectManufacturer =
"SELECT * FROM manufacturer";
7             $result_selectManufacturer = mysqli_query($con,$query_selectManufacturer);
8             
if($_SERVER['REQUEST_METHOD'] == "POST") {
9                 
if(isset($_POST['chkId'])) {
10                     $chkId = $_POST[
'chkId'];
11                     
foreach($chkId as $id) {
12                         $query_deleteManufacturer =
"DELETE FROM manufacturer WHERE man_id='$id'";
13                         $result = mysqli_query($con,$query_deleteManufacturer);
14                     }
15                     
if(!$result) {
16                         echo
"<script> alert(\"There was some problems deleting manufacturer\"); </script>";
17                         header(
'Refresh:0');
18                     }
19                     
else {
20                         echo
"<script> alert(\"manufacturers Deleted Successfully\"); </script>";
21                         header(
'Refresh:0');
22                     }
23                 }
24             }
25         }
26         
else {
27             header(
'Location:../index.php');
28         }
29     }
30     
else {
31         header(
'Location:../index.php');
32     }
33 ?>
34 <!DOCTYPE html>
35 <html>
36 <head>
37     <title> View Manufacturer </title>
38     <link rel=
"stylesheet" href="../includes/main_style.css" >
39     <script language=
"JavaScript">
40     function toggle(source) {
41         checkboxes = document.getElementsByName(
'chkId[]');
42         
for(var i=0, n=checkboxes.length;i<n;i++) {
43             checkboxes[i].
checked = source.checked;
44         }
45     }
46     </script>
47 </head>
48 <body>
49     <?php
50         include(
"../includes/header.inc.php");
51         include(
"../includes/nav_admin.inc.php");
52         include(
"../includes/aside_admin.inc.php");
53     ?>
54     <section>
55         <h1>View Manufacturer</h1>
56         <form action=
"" method="POST" class="form">
57         <table
class="table_displayData">
58             <tr>
59                 <th> <input type=
"checkbox" onClick="toggle(this)" /> </th>
60                 <th>Sr. No.</th>
61                 <th>Name</th>
62                 <th>Email</th>
63                 <th>Phone</th>
64                 <th>Username</th>
65                 <th> Edit </th>
66             </tr>
67             <?php $i=
1; while($row_selectManufacturer = mysqli_fetch_array($result_selectManufacturer)) { ?>
68             <tr>
69                 <td> <input type=
"checkbox" name="chkId[]" value="<?php echo $row_selectManufacturer['man_id']; ?>" /> </td>
70                 <td> <?php echo $i; ?> </td>
71                 <td> <?php echo $row_selectManufacturer[
'man_name']; ?> </td>
72                 <td> <?php echo $row_selectManufacturer[
'man_email']; ?> </td>
73                 <td> <?php echo $row_selectManufacturer[
'man_phone']; ?> </td>
74                 <td> <?php echo $row_selectManufacturer[
'username']; ?> </td>
75                 <td> <a href=
"edit_manufacturer.php?id=<?php echo $row_selectManufacturer['man_id']; ?>"><img src="../images/edit.png" alt="edit" /></a> </td>
76             </tr>
77             <?php $i++; } ?>
78         </table>
79         <input type=
"submit" value="Delete" class="submit_button"/>
80         </form>
81     </section>
82     <?php
83         include(
"../includes/footer.inc.php");
84     ?>
85 </body>
86 </html>


Gõ tìm kiếm nhanh...